using System;
namespace MonsterNetWindows
{
	public partial class MNBusyWindow : Gtk.Window
	{		
		private string _message;
		public bool Stop = false;
		private bool _pulsing = false;
		
		public string Message {
			get {
				return this._message;
			}
			set {
				_message = value;
				progressbarBusy.Text = _message;
			}
		}

		public MNBusyWindow () : base(Gtk.WindowType.Popup)
		{
			this.Build ();
			
		}
		
		public void Pulse() {
			
			if(!_pulsing) {
				//start pulsing
				System.Threading.Thread.Sleep(2000);
				GLib.Timeout.Add (100, new GLib.TimeoutHandler (StatusPulse));		
				_pulsing = true;
			}
		}
		
		private bool StatusPulse() {
			progressbarBusy.Pulse();
			return !Stop;
		}		
	}
}

